import {createRouter, createWebHashHistory} from 'vue-router'
import routes from "./routes"
import _ from "lodash"

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

let detailScreenList = _.filter(_.map(routes, route => route.name), name => !["Home"].includes(name))
router.beforeEach((to, from, next) => {
    if (detailScreenList.includes(to.name)) {
        document.title = to.query.name
    }
    next()
})

export default router
